package com.dao;

import org.hibernate.Session;

import com.Interfacese.AlertUserInterface;
import entities.Users;
import com.util.*;
public class AlertUsers {

	public void alertUser(Users u,String name) {
		Session session=null;
		try{
			session=HbnUtil.getSession();
			session.beginTransaction();
			Users user =(Users) session.createQuery("from Users as u where u.username='"+name+"'").uniqueResult();
			//user.setUserAccount(u.getUserAccount());
			//user.setUserAddress(u.getUserAddress());
			user.setPassword(u.getPassword());
			user.setName(u.getName());
			user.setPhone(u.getPhone());
			session.update(user);
			session.beginTransaction().commit();
		}catch(Exception e){
			e.printStackTrace();
			session.beginTransaction().rollback();
		}finally{
			HbnUtil.releaseSession(session);
		}
	}

}
